<?php
class uploader_add extends SClass {

    public function process() {
        try {
            if ($this->getControlValue('upload')) {
                $file = $this->getControlValue('file');
                $file_tmp = $file['tmp_name'];
                $name = $file['name'];
                ServiceUtils::GetFactory()->getFilesService()->addFiles(
                    $file_tmp,
                    $name,
                    $this->getControlValue('alias')
                );
                $this->assign('message', 'ok');
            }
        } catch (ServiceUtils_Exception $exception) {
            $this->assign('message', 'error');
        }
    }

}